clear
echo -e "\033[33m 欢迎使用StarryDew安装向导 \033[0m"
echo -e "\033[33m 按回车键继续安装，Ctrl+C 退出安装 \033[0m"
read
clear
echo -e "\033[33m 正在切换清华源...... \033[0m"
sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/termux-packages-24 stable main@' $PREFIX/etc/apt/sources.list
sed -i 's@^\(deb.*games stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/game-packages-24 games stable@' $PREFIX/etc/apt/sources.list.d/game.list
sed -i 's@^\(deb.*science stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/science-packages-24 science stable@' $PREFIX/etc/apt/sources.list.d/science.list

echo -e "\033[33m 正在更新系统环境...... \033[0m"
apt update -y
apt upgrade -y
echo -e "\033[32m 完成 \033[0m"
echo -e "\033[33m 正在检查并安装必要软件...... \033[0m"
apt install git nodejs tar -y
echo -e "\033[32m 完成 \033[0m"
echo -e "\033[33m 正在下载StarryDew压缩包...... \033[0m"
cd ~
git clone https://gitee.com/ucket/install_starrydew
echo -e "\033[32m 完成 \033[0m"
echo -e "\033[33m 正在安装Starrydew...... \033[0m"
mv ./install_starrydew/starrydew.tar.gz ~/
rm -rf install_starrydew/
tar -zxvf starrydew.tar.gz
chmod +x ./starrydew/starrydew.js
touch starry
echo 'cd starrydew && node starrydew.js' > starry
chmod +x starry
clear
echo -e "\033[32m Starrydew安装完成 \033[0m"
echo -e "\033[32m   _____ __                        ____              \033[0m"
echo -e "\033[32m  / ___// /_____ _____________  __/ __ \___ _      __ \033[0m"
echo -e "\033[32m  \__ \/ __/ __  / ___/ ___/ / / / / / / _ \ | /| / /\033[0m"
echo -e "\033[32m ___/ / /_/ /_/ / /  / /  / /_/ / /_/ /  __/ |/ |/ / \033[0m"
echo -e "\033[32m/____/\__/\__,_/_/  /_/   \__, /_____/\___/|__/|__/  \033[0m"
echo -e "\033[32m                         /____/                      \033[0m"
echo -e "\033[33m 请使用 cd ~ ; ./starry 命令启动 \033[0m"
echo -e "\033[33m 请按回车键退出安装向导...... \033[0m"
read
